package siena.jdbc.test.test6;

import siena.Column;
import siena.Id;
import siena.Model;
import siena.Query;
import siena.Table;

@Table("discoverings")
public class Discovery extends Model {

	@Id
	public String name;
	@Id @Column({ "first_name", "last_name" })
	public Person discoverer;
	public int year;

	public Discovery() {
	}

	public Discovery(String name, Person discoverer) {
		this.discoverer = discoverer;
		this.name = name;
	}

	public static Discovery get(String name, Person discoverer) {
		Discovery d = new Discovery(name, discoverer);
		d.get();
		return d;
	}

	public static Query<Discovery> all() {
		return Model.all(Discovery.class);
	}

	public String toString() {
		return "name: "+name+", discoverer: "+discoverer;
	}

}
